<div>
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <h1>欢迎注册</h1>

            <div class="alert alert-success" ng-show="success">
                <strong>注册成功</strong> 请去邮箱激活！
                </div>
        </div>

            <div class="alert alert-danger" ng-show="error">
                <strong>注册失败</strong> 请再次尝试
            </div>

            <div class="alert alert-danger" ng-show="errorUserExists">
                <strong>登录名已存在</strong> 换一个吧
            </div>

            <div class="alert alert-danger" ng-show="errorEmailExists">
                <strong>邮箱已经存在</strong> 换一个吧.
            </div>

            <div class="alert alert-danger" ng-show="doNotMatch">
                两次输入密码不匹配
            </div>
        </div>
        <div class="col-md-8 col-md-offset-2">
            <form ng-show="!success" name="form" role="form" novalidate ng-submit="register()" show-validation>

                <div class="form-group">
                    <label class="control-label" for="login">登录名</label>
                    <input type="text" class="form-control" id="login" name="login" placeholder="{{'global.form.username.placeholder' | translate}}"
                           ng-model="registerAccount.login" ng-minlength=5 ng-maxlength=20 ng-pattern="/^[a-z0-9]*$/" required>
                    <div ng-show="form.login.$dirty && form.login.$invalid">
                        <p class="help-block"
                               ng-show="form.login.$error.required">
                            必须
                        </p>
                        <p class="help-block"
                               ng-show="form.login.$error.minlength">
                            至少5个字符
                        </p>
                        <p class="help-block"
                               ng-show="form.login.$error.maxlength">
                           最多20个字符
                        </p>
                        <p class="help-block"
                               ng-show="form.login.$error.pattern">
                            格式不正确.
                    </p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label" for="email">邮箱</label>
                    <input type="email" class="form-control" id="email" name="email" placeholder="{{'global.form.email.placeholder' | translate}}"
                           ng-model="registerAccount.email" ng-minlength=5 ng-maxlength=100 required>
                    <div ng-show="form.email.$dirty && form.email.$invalid">
                        <p class="help-block"
                               ng-show="form.email.$error.required">
                           必须
                        </p>
                        <p class="help-block"
                               ng-show="form.email.$error.email">
                            无效邮箱
                        </p>
                        <p class="help-block"
                               ng-show="form.email.$error.minlength">
                            至少5个字符
                        </p>
                        <p class="help-block"
                               ng-show="form.email.$error.maxlength">
                            最多100个字符
                        </p>
                    </div>
                </div>
                <div class="form-group">
                    <label>手机号</label>
                    <input type="mobile" class="form-control" name="mobile" placeholder="Your mobile"
                           ng-model="registerAccount.mobile" ng-minlength=11 required>
                    <div ng-show="form.mobile.$dirty && form.mobile.$invalid">
                        <p class="help-block"
                           ng-show="form.mobile.$error.required">
                           必须.
                        </p>
                        <p class="help-block"
                           ng-show="form.mobile.$error.mobile">
                            无效手机号
                        </p>
                        <p class="help-block"
                           ng-show="form.mobile.$error.minlength">
                           至少11位
                        </p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label" for="password">密码</label>
                    <input type="password" class="form-control" id="password" name="password" placeholder="{{'global.form.newpassword.placeholder' | translate}}"
                           ng-model="registerAccount.password" ng-minlength=5 ng-maxlength=20 required>
                    <div ng-show="form.password.$dirty && form.password.$invalid">
                        <p class="help-block"
                               ng-show="form.password.$error.required">
                           必须
                        </p>
                        <p class="help-block"
                               ng-show="form.password.$error.minlength">
                            至少5位
                        </p>
                        <p class="help-block"
                               ng-show="form.password.$error.maxlength">
                            最多20位
                        </p>
                    </div>
                    <password-strength-bar password-to-check="registerAccount.password"></password-strength-bar>
                </div>
                <div class="form-group">
                    <label class="control-label" for="confirmPassword">确认密码</label>
                    <input type="password" class="form-control" id="confirmPassword" name="confirmPassword" placeholder="{{'global.form.confirmpassword.placeholder' | translate}}"
                           ng-model="confirmPassword" ng-minlength=5 ng-maxlength=20 required>
                    <div ng-show="form.confirmPassword.$dirty && form.confirmPassword.$invalid">
                        <p class="help-block"
                               ng-show="form.confirmPassword.$error.required">
                            必须
                        </p>
                        <p class="help-block"
                               ng-show="form.confirmPassword.$error.minlength">
                            至少5位                        </p>
                        <p class="help-block"
                               ng-show="form.confirmPassword.$error.maxlength">
                            最多20位
                        </p>
                    </div>
                </div>

                <button type="submit" ng-disabled="form.$invalid" class="btn btn-primary" translate="register.form.button">Register</button>
            </form>
            <p></p>
        </div>
    </div>
</div>
